Fix for bug 672961 - Custom theme can crash apps with GtkEntryCompletion
authorBenjamin Otte <otte@redhat.com>
Wed, 28 Mar 2012 00:29:56 +0000 (20:29 -0400)
committerJoanmarie Diggs <jdiggs@igalia.com>
Wed, 28 Mar 2012 00:29:56 +0000 (20:29 -0400)
gtk/gtkentrycompletion.c

index bfaaa1ca15d220bcad7ef42a86c266845746b75c..8367ed9957a89eb394da1e4a50d0c12b66335571 100644 (file)
@@ -1513,7 +1513,9 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
   monitor_num = gdk_screen_get_monitor_at_window (screen, window);
   gdk_screen_get_monitor_workarea (screen, monitor_num, &monitor);
 
-  if (y > monitor.height / 2)
+  if (height == 0)
+    items = 0;
+  else if (y > monitor.height / 2)
     items = MIN (matches, (((monitor.y + y) - (actions * action_height)) / height) - 1);
   else
     items = MIN (matches, (((monitor.height - y) - (actions * action_height)) / height) - 1);